
layui.config({
	base: basePath, 
	version: skyeyeVersion
}).extend({
    window: 'js/winui.window'
}).define(['window', 'jquery', 'winui', 'fileUpload'], function (exports) {
	winui.renderColor();
	layui.use(['form'], function (form) {
		var index = parent.layer.getFrameIndex(window.name);
	    var $ = layui.$;

	    //帖子信息展示
        AjaxPostUtil.request({url: sysMainMation.admBasePath + "queryForumContentById", params: {id : parent.forumId}, type: 'json', callback: function (json) {
			$("#content").html(json.bean.forumContent);
			$("#title").html(json.bean.forumTitle);
			$("#createTime").html(json.bean.createTime);
			$("#photo").html("<img userId=" + json.bean.userId + " alt='' src=" + json.bean.createMation.userPhoto + ">");
			$("#content").removeClass("layui-hide");
			$("#showForm").removeClass("layui-hide");
			matchingLanguage();
        }});
	    
	    //单选框变化事件
 		form.on('radio(examineState)', function (data) {
 			var val = data.value;
	    	if(val == '2'){//审核通过
	    		$("#reasonHide").addClass("layui-hide");
	    		$("#examineNopassReason").val("");
	    	} else if (val == '3'){//审核不通过
	    		$("#reasonHide").removeClass("layui-hide");
	    	} else {
	    		winui.window.msg('状态值错误', {icon: 2, time: 2000});
	    	}
        });
	    
 		form.render();
 	    form.on('submit(formAddBean)', function (data) {
 	        if (winui.verifyForm(data.elem)) {
 	        	var params = {
        			id: parent.rowId,
 	        		state: data.field.examineState,
        			reason: $("#examineNopassReason").val()
 	        	};
 	        	AjaxPostUtil.request({url: sysMainMation.admBasePath + "checkForumReport", params: params, type: 'json', callback: function (json) {
					parent.layer.close(index);
					parent.refreshCode = '0';
	 	   		}});
 	        }
 	        return false;
 	    });
 	    
	    $("body").on("click", "#cancle", function() {
	    	parent.layer.close(index);
	    });
	});
});